1. Field of the Invention
The invention relates generally to computer architectures and, more particularly, to a method and an apparatus for shifting an operand a specified direction and amount.
2. Description of Related Art
Computer processors are constantly being designed with additional capabilities. In particular, some processors, such as the PowerPC designed by IBM Corp., Apple Computers Corp., and Motorola, Inc., are being modified to provide multimedia extensions, such as the Vector Multimedia Extension (VMX). Some extensions such as a shift instruction, however, require additional processing and, therefore, may not be as efficient as desired.
Shift instructions frequently utilize multiple operands to specify the desired action. A first operand typically specifies the operand that is to be shifted left or right, a second operand typically specifies the amount that the first operand is to be shifted, and a third operand typically specifies the location to place the result. Additional, or fewer, operands may be present depending on the implementation.
Generally, the second operand that specifies the amount must be decoded to extract the necessary information and to format the information appropriately. The process of decoding the second operand, however, is processing-intensive and requires additional space.
Therefore, there is a need to provide a method and an apparatus for efficiently shifting a value a specified amount and direction.